/*
 * @Descripttion:
 * @Author: jhw
 * @Date: 2024-06-20 15:27:43
 * @LastEditors: jhw
 * @LastEditTime: 2024-06-25 10:48:08
 */
// { label: '字典名称或编码', type: 'input', field: 'keyword', labelWidth: '110px' },
// { label: '渠道类型', type: 'select', field: 'channelType', labelWidth: '100px', extra: 'channelType' },

import type { DatePickerProps, ISelectProps, TimePickerDefaultProps } from 'element-plus';
type searchTypeProps = 'input' | 'select' | 'datepicker' | 'select2' | 'timepicker' | 'datetime' | 'treeselect';
// | 'datetimerange'
// | 'number'
// | 'cascader'
// | 'checkbox'
// | 'radio'
// | 'switch'
// | 'slider'
// | 'rate'
// | 'time'
// | 'color'
// | 'transfer';

interface IOptions {
  label: string;
  value: string | number;
}

type OtherProps<T extends searchTypeProps> = T extends 'datepicker'
  ? Partial<DatePickerProps>
  : T extends 'select2'
  ? Partial<ISelectProps>
  : T extends 'timepicker'
  ? Partial<TimePickerDefaultProps>
  : any;

export interface IListPropsItem<K = true, T extends searchTypeProps = 'input'> {
  label?: string;
  ariaLabel?: string;
  prop: K extends Boolean ? string : keyof K;
  searchType: searchTypeProps;
  labelWidth?: string;
  extra?: string;
  options?: Array<IOptions>;
  otherProps?: OtherProps<T>;
  [key: string]: any;
}

export type IListPropsType<T = true> = Array<
  IListPropsItem<T> | IListPropsItem<T, 'datepicker'> | IListPropsItem<T, 'select2'> | IListPropsItem<T, 'timepicker'>
>;

export type dictPropsType = {
  [key: string]: Array<IOptions>;
};
